<?php
class Admin_Model_Product extends Zend_Db_Table_Abstract
{
	protected $_name= "sanpham";
	
	public function getProducSes($id)
	{
		$row=$this->fetchAll('idTL='.$id);
		return $row;
	}
	public function getProducCat($id)
	{
		$row=$this->fetchAll('idLoai='.$id);
		return $row;
	}
	public function addProduct($namePro,$sumary,$descripPro,$idSes,$idCat,$date,$count,$image,$price)
	{
		$data=array(
		'TenSP'  =>$namePro,
		'idTL'   =>$idSes,
		'idLoai' =>$idCat,
		'TomTat' =>$sumary,
		'ChiTiet'=>$descripPro,
		'SoLuong'=>$count,
		'luotxem'=>1,
		'NgayDang'=>$date,
		'Image'  =>$image,
		'Gia'    =>$price
		);

		$this->insert($data);
	}
	public function editProduct($idPro,$namePro,$sumary,$descripPro,$idSes,$idCat,$date,$count,$image,$price)
	{
		$data=array(
		'TenSP'  =>$namePro,
		'idTL'   =>$idSes,
		'idLoai' =>$idCat,
		'TomTat' =>$sumary,
		'ChiTiet'=>$descripPro,
		'SoLuong'=>$count,
		'luotxem'=>1,
		'NgayDang'=>$date,
		'Image'  =>$image,
		'Gia'    =>$price
		);
		
		$this->update($data,'idSP='.$idPro);
	}
	public function deleteProduct($idPro)
	{
		$this->delete('idSP='.$idPro);
	}
	
}